﻿// JavaScript Document
var errorMessage = "";
var capchaR;
var rand = Math.random();
var timeOut = 1;

function timeout(){
	if (timeOut >= 5){
		$('#bl-loicapcha').hide();
		}
		timeOut ++;
	}


function textbox(box, boxval){
	$(box).val(boxval);
	$(box).focus(function(){
		if($(this).val()== boxval) {
			$(this).val('');
			$(this).css('color','#4B4B4B');
			$(this).css('font-style','normal');
			}
		})
	$(box).blur(function(){
		if($(this).val()== '') {
			$(this).css('color','#A99A9A');
			$(this).css('font-style','italic');
			$(this).val(boxval);
			}
		
		})
	}
	


function checkLength(box, value){
	if ($(box).val().length > value){
		return true;
		}else{return false;}
	}
	
function checkMail(mailForm){
	var mailFilter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	return mailFilter.test($(mailForm).val());
	}	


// Lien He========================
function checkLienhe(){
	$('#contact-form .error').removeClass('error');
	errorMessage = '<span style="margin-left:-13px; font-weight:bold;">Ráº¥t tiáº¿c! ThÃ´ng Ä‘iá»‡p cá»§a báº¡n khÃ´ng thá»ƒ gá»­i vÃ¬ cÃ¡c lá»—i sau:</span>';
	var name = true;
	var mail = true;
	var content = true;
	var phone = true;
	
	
	if(!checkLength('#lhname', 0)){ 
		$('#lhname').addClass('error');
		errorMessage += '<li>Báº¡n chÆ°a nháº­p <b>há» tÃªn</b>.</li>';
		name = false;
		}else if(!checkLength('#lhname', 4)){
			$('#lhname').addClass('error');
			errorMessage += '<li>Dá»¯ liá»‡u báº¡n nháº­p trong Ã´ "<b>Há» tÃªn</b>" quÃ¡ ngáº¯n.</li>';
			name = false;
			}
	
	if(!checkLength('#lhemail', 0)){ 
		$('#lhemail').addClass('error');
		errorMessage += "<li>Báº¡n chÆ°a nháº­p Ä‘á»‹a chá»‰ <b>email</b>.</li>";
		mail = false;
		}else if (!checkMail('#lhemail')){
			$('#lhemail').addClass('error');
			errorMessage += "<li>Äá»‹a chá»‰ <b>email</b> báº¡n nháº­p khÃ´ng há»£p lá»‡.</li>";
			mail = false;
			};
		
	if(!checkLength('#lhphone', 0)){ 
		$('#lhphone').addClass('error');
		errorMessage += "<li>Báº¡n chÆ°a nháº­p <b>Sá»‘ Ä‘iá»‡n thoáº¡i</b>.</li>";
		phone = false;}
	else if(isNaN($('#lhphone').val()) || $('#lhphone').val().length < 7){
		$('#lhphone').addClass('error');
		errorMessage += "<li><b>Sá»‘ Ä‘iá»‡n thoáº¡i</b> báº¡n nháº­p khÃ´ng há»£p lá»‡.</li>";
		phone = false;
		};
		
	if(!checkLength('#cusContent', 0)){ 
		$('#cusContent').addClass('error');
		errorMessage += "<li>Báº¡n chÆ°a nháº­p <b>Ná»™i dung</b> LiÃªn há»‡.</li>";
		content = false;
		}else if(!checkLength('#cusContent', 20)){
			$('#cusContent').addClass('error');
			errorMessage += "<li>Má»¥c <b>Ná»™i dung</b> báº¡n nháº­p quÃ¡ ngáº¯n.</li>";
			content = false;
			}

	
		
	var ketqua = name && mail && content && phone;	 
	if(!ketqua)	{
		$('#lhe-baoloi ul').html(errorMessage);
		if($('#lhe-baoloi').css('display') == 'none'){
			$('#lhe-baoloi').slideDown();
		}else {
			i = $('#lhe-baoloi li').length;
			$('#lhe-baoloi').stop().animate({height:i*18+18});
			}
		return false;
		}
	else{
		
		$('#contact-form .error').removeClass('error');
		$('#lhe-loading').slideDown();
		$('#lhe-baoloi').slideUp();
		
		var ten = $('#lhname').val();
		var dcmai = $('#lhemail').val();
		var dienthoai = $('#lhphone').val();
		var diachi = $('#lhaddress').val();
		var yckhac = $('#cusContent').val();
		var url = "../mail/send3.php?name=" + ten + "&email=" + dcmai + "&address=" + diachi + "&phone=" + dienthoai + "&cusContent=" + yckhac;
		//alert(url);
			$.ajax({
			  url: url,
			  cache: false,
			  success: function(data){
				$('#lhe-baoloi ul').html('<strong>CÃ¡m Æ¡n quÃ½ khÃ¡ch Ä‘Ã£ liÃªn há»‡. ChÃºng tÃ´i sáº½ liÃªn há»‡ vá»›i quÃ½ khÃ¡ch trong thá»i gian sá»›m nháº¥t.</strong>');
					$('#lhe-baoloi').css("height","18px");
					$('#lhe-baoloi').slideDown();
					$('#contact-form ')[0].reset();	
					$('#lhe-loading').slideUp();
				  }
			});
		
		 return false;
		}
	}
	

//End Lienhe========================================================


// Du an========================
function checkDuan(){
	$('#form-bl .error').removeClass('error');
	errorMessage = "";
	var name = true;
	var mail = true;
	var content = true;
	var phone = true;
	
	
	if(!checkLength('#hoten', 0)){ 
		$('#hoten').addClass('error');
		errorMessage += '<li>Báº¡n chÆ°a nháº­p <b>há» tÃªn</b>.</li>';
		name = false;
		}else if(!checkLength('#hoten', 4)){
			$('#hoten').addClass('error');
			errorMessage += '<li>Dá»¯ liá»‡u báº¡n nháº­p trong Ã´ "<b>Há» tÃªn</b>" quÃ¡ ngáº¯n.</li>';
			name = false;
			}
	
	if(!checkLength('#mail', 0)){ 
		$('#mail').addClass('error');
		errorMessage += "<li>Báº¡n chÆ°a nháº­p Ä‘á»‹a chá»‰ <b>email</b>.</li>";
		mail = false;
		}else if (!checkMail('#mail')){
			$('#mail').addClass('error');
			errorMessage += "<li>Äá»‹a chá»‰ <b>email</b> báº¡n nháº­p khÃ´ng há»£p lá»‡.</li>";
			mail = false;
			};
	
	if(!checkLength('#noidung', 0)){ 
		$('#noidung').addClass('error');
		errorMessage += "<li>Báº¡n chÆ°a nháº­p <b>YÃªu cáº§u khÃ¡c</b>.</li>";
		content = false;
		}else if(!checkLength('#noidung', 20)){
			$('#noidung').addClass('error');
			errorMessage += "<li>Má»¥c <b>YÃªu cáº§u khÃ¡c</b> báº¡n nháº­p quÃ¡ ngáº¯n.</li>";
			content = false;
			}
	
	if ((isNaN($('#dienthoai').val()) || $('#dienthoai').val().length < 7) && $('#dienthoai').val().length > 0){
		$('#dienthoai').addClass('error');
		errorMessage += "<li><b>Sá»‘ Ä‘iá»‡n thoáº¡i</b> báº¡n nháº­p khÃ´ng há»£p lá»‡.</li>";
		phone = false;
		};
	
		
	var ketqua = name && mail && content && phone;	 
	if(!ketqua)	{
		$('#dt-baoloi ul').html(errorMessage);
		if($('#dt-baoloi').css('display') == 'none'){
			$('#dt-baoloi').slideDown();
		}else {
			i = $('#dt-baoloi li').length;
			$('#dt-baoloi').stop().animate({height:i*18});
			}
		return false;
		}
	else{
		
		$('#dathang-form .error').removeClass('error');
		$('#loading').slideDown();
		$('#dt-baoloi').slideUp();
		
		var ten = $('#hoten').val();
		var dcmai = $('#mail').val();
		var tencty = $('#ctencty').val();
		var dienthoai = $('#dienthoai').val();
		var diachi = $('#diachi').val();
		var yckhac = $('#noidung').val();
		var thamkhao = $('#idSP').val();
		var url = "../mail/send2.php?hoten=" + ten + "&mail=" + dcmai + "&tencty=" + tencty + "&diachi=" + diachi + "&dienthoai=" + dienthoai + "&noidung=" + yckhac + "&idSP=" + thamkhao;
		//alert(url);
			$.ajax({
			  url: url,
			  cache: false,
			  success: function(data){
				$('#dt-baoloi ul').html('<strong>CÃ¡m Æ¡n quÃ½ khÃ¡ch Ä‘Ã£ Ä‘áº·t hÃ ng. ChÃºng tÃ´i sáº½ liÃªn há»‡ vá»›i quÃ½ khÃ¡ch trong thá»i gian sá»›m nháº¥t.</strong>');
				if($('#dt-baoloi').css('display') == 'none'){
					$('#dt-baoloi').css("height","36px");
					$('#dt-baoloi').slideDown();
				}else {
					i = $('#dt-baoloi li').length;
					$('#dt-baoloi').stop().animate({height:36});
					}
					$('#dathang-form')[0].reset();	
					$('#loading').slideUp();
				  }
			});
		
		 return false;
		}
	}
	

//End Duan========================================================


function checkBl(){
	$('#form-bl .error').removeClass('error');
	errorMessage = "";
	var name = true;
	var mail = true;
	var content = true;
	var cap = true;
	
	
	if(!checkLength('#blname', 0) || $('#blname').val() == 'Há» tÃªn'){ 
		$('#blname').addClass('error');
		errorMessage += '<li>Báº¡n chÆ°a nháº­p <b>há» tÃªn</b>.</li>';
		name = false;
		}else if(!checkLength('#blname', 4)){
			$('#blname').addClass('error');
			errorMessage += '<li>Dá»¯ liá»‡u báº¡n nháº­p trong Ã´ "<b>Há» tÃªn</b>" quÃ¡ ngáº¯n.</li>';
			name = false;
			}
	
	if(!checkLength('#blemail', 0)|| $('#blemail').val() == 'E-mail'){ 
		$('#blemail').addClass('error');
		errorMessage += "<li>Báº¡n chÆ°a nháº­p Ä‘á»‹a chá»‰ <b>email</b>.</li>";
		mail = false;
		}else if (!checkMail('#blemail')){
			$('#blemail').addClass('error');
			errorMessage += "<li>Äá»‹a chá»‰ <b>email</b> báº¡n nháº­p khÃ´ng há»£p lá»‡.</li>";
			mail = false;
			};
	
	if(!checkLength('#loibinh', 0)|| $('#loibinh').val() == 'Ã kiáº¿n '){ 
		$('#loibinh').addClass('error');
		errorMessage += "<li>Báº¡n chÆ°a nháº­p <b>ná»™i dung</b>.</li>";
		content = false;
		}else if(!checkLength('#loibinh', 20)){
			$('#loibinh').addClass('error');
			errorMessage += "<li><b>Ná»™i dung</b> bÃ¬nh luáº­n báº¡n nháº­p quÃ¡ ngáº¯n.</li>";
			content = false;
			}
	
	
	if(!checkLength('#code', 0) || $('#code').val() == 'MÃ£ báº£o vá»‡'){ 
		$('#code').addClass('error');
		errorMessage += '<li>Báº¡n chÆ°a nháº­p <b>MÃ£ báº£o vá»‡</b>.</li>';
		cap = false;
		}else if($('#code').val().length != 5){
			$('#code').addClass('error');
			errorMessage += '<li><b>MÃ£ báº£o vá»‡</b> pháº£i cÃ³ 5 kÃ½ tá»±.</li>';
			cap = false;
			}
		
        //submit post to check.php and reload image
		
		
	var ketqua = name && mail && content && cap;	 
	
	
		
	if(!ketqua)	{
		$('#bl-baoloi ul').html(errorMessage);
		if($('#bl-baoloi').css('display') == 'none'){
			$('#bl-baoloi').slideDown();
		}else {
			i = $('#bl-baoloi li').length;
			$('#bl-baoloi').stop().animate({height:i*18});
			}
		return false;
		}
	}





function checkContact(){
	$('.error').removeClass('error');
	errorMessage = "";
	var name = true;
	var mail = true;
	var phone = true;
	var content = true; 
	
	if(!checkLength('#name', 0)){ 
		$('#name').addClass('error');
		errorMessage += '<li>Báº¡n chÆ°a nháº­p <b>há» tÃªn</b>.</li>';
		name = false;
		}else if(!checkLength('#name', 5)){
			$('#name').addClass('error');
			errorMessage += '<li>Dá»¯ liá»‡u báº¡n nháº­p trong Ã´ "<b>Há» tÃªn</b>" quÃ¡ ngáº¯n.</li>';
			name = false;
			}
	
	if(!checkLength('#email', 0)){ 
		$('#email').addClass('error');
		errorMessage += "<li>Báº¡n chÆ°a nháº­p Ä‘á»‹a chá»‰ <b>email</b>.</li>";
		mail = false;
		}else if (!checkMail('#email')){
			$('#email').addClass('error');
			errorMessage += "<li>Äá»‹a chá»‰ <b>email</b> báº¡n nháº­p khÃ´ng há»£p lá»‡.</li>";
			mail = false;
			};
			
			
	if(!checkLength('#content', 0)){ 
		$('#content').addClass('error');
		errorMessage += "<li>Báº¡n chÆ°a nháº­p <b>ná»™i dung</b>.</li>";
		content = false;
		}else if(!checkLength('#content', 20)){
			$('#content').addClass('error');
			errorMessage += "<li><b>Ná»™i dung</b> liÃªn há»‡ báº¡n nháº­p quÃ¡ ngáº¯n.</li>";
			content = false;
			}
	
	
	if(!checkLength('#phone', 0)){ 
		$('#phone').addClass('error');
		errorMessage += "<li>Báº¡n chÆ°a nháº­p <b>Sá»‘ Ä‘iá»‡n thoáº¡i</b>.</li>";
		phone = false;}
	
	else if ((isNaN($('#phone').val()) || $('#phone').val().length < 7) && $('#phone').val().length > 0){
			$('#phone').addClass('error');
			errorMessage += "<li><b>Sá»‘ Ä‘iá»‡n thoáº¡i</b> báº¡n nháº­p khÃ´ng há»£p lá»‡.</li>";
			phone = false;
			};
	
	var ketqua = name && mail && phone && content;	
		
	if(!ketqua)	{
		$('#lh-baoloi ul').html(errorMessage);
		if($('#lh-baoloi').css('display') == 'none'){
			$('#lh-baoloi').slideDown();
		}else {
			i = $('#lh-baoloi li').length;
			$('#lh-baoloi').stop().animate({height:i*18});
			}
		return false;
		}
		

	else{
		
		$('#contact-form .error').removeClass('error');
		$('#lh-loading').slideDown();
		$('#lh-baoloi').slideUp();
		
		var ten = $('#name').val();
		var dcmai = $('#email').val();
		var dienthoai = $('#phone').val();
		var diachi = $('#address').val();
		var yckhac = $('#content').val();
		var url = "../mail/send3.php?name=" + ten + "&email=" + dcmai + "&address=" + diachi + "&phone=" + dienthoai + "&cusContent=" + yckhac;
		//alert(url);
			$.ajax({
			  url: url,
			  cache: false,
			  success: function(data){
				$('#lh-baoloi ul').html('<strong>CÃ¡m Æ¡n Ä‘Ã£ quan tÃ¢m. ChÃºng tÃ´i sáº½ liÃªn há»‡ láº¡i trong thá»i gian sá»›m nháº¥t.</strong>');
				$('#lh-baoloi').css("height","36px");
				$('#lh-baoloi').slideDown();
				$('#lh-loading').slideUp();
				$('#lh-form')[0].reset();
					
				  }
			});
		
		 return false;
		}
			
	}
//=========================================================================================================================================================================



function menu(){
	
		$('#main-menu li').not('.active').find('a').hover(function(){
			$(this).find('.menu-top').stop().animate({height:'60px'}, 1000, 'easeOutExpo');
			$(this).find('.menu-icon').stop().animate({height:'60px'}, 1000, 'easeOutExpo');
			$('#main-menu .active').find('.menu-top').stop().animate({height:'47px'}, 1000, 'easeOutExpo');
			$('#main-menu .active').find('.menu-icon').stop().animate({height:'0'}, 1000, 'easeOutExpo');

		},
		function(){
			$(this).find('.menu-top').stop().animate({height:'47px'}, 1000, 'easeOutExpo');
			$(this).find('.menu-icon').stop().animate({height:'0'}, 1000, 'easeOutExpo');
			$('#main-menu .active').find('.menu-top').stop().animate({height:'60px'}, 1000, 'easeOutExpo');
			$('#main-menu .active').find('.menu-icon').stop().animate({height:'60px'}, 1000, 'easeOutExpo');
		});
	}

$(document).ready(function(){
	textbox('#form-bl #blname','Há» tÃªn');	
	textbox("#form-bl #blemail","E-mail");
	textbox("#form-bl #loibinh","Ã kiáº¿n");
	textbox("#form-bl #code","MÃ£ báº£o vá»‡");
	textbox('#search-txt', 'Nháº­p tá»« khÃ³a...');
//menu



		//Pricing
		
		
	/*$('.price-col').hover(function(){
				$('#label-wrapper').addClass('hover');
			},function(){
				$('#label-wrapper').removeClass('hover');
			})*/
		
		
		$('#starter').hover(function(){
			
			$('#shopper').stop().animate({left:'445px'},300,function(){
				$('#overlay').show();
				$('#starter').addClass('hover');
				$('#label-wrapper').addClass('hover');
				$('#shopper').stop().animate({left:'430px'},300);
				});
			},function(){
				$('#shopper').stop().animate({left:'445px'},300,function(){
					$('#overlay').hide()
					$('#starter').removeClass('hover');
					$('#label-wrapper').removeClass('hover');
					$('#shopper').stop().animate({left:'430px'},300);
				});
				});
				
		$('#shopper').hover(function(){
			$('#e-comerce').stop().animate({left:'575px'},300,function(){
				$('#overlay').show();
				$('#shopper').addClass('hover');
				$('#label-wrapper').addClass('hover');
				$('#e-comerce').stop().animate({left:'560px'},300);
				});
			},function(){
				$('#e-comerce').stop().animate({left:'575px'},300,function(){
					$('#overlay').hide()
					$('#shopper').removeClass('hover');
					$('#label-wrapper').removeClass('hover');
					$('#e-comerce').stop().animate({left:'560px'},300);
				});
				
				});	
			
			$('#e-comerce').hover(function(){
					if($.browser.msie){$('#overlay').show();}
					else $('#overlay').fadeIn(500);
					$(this).addClass('hover');
					$('#label-wrapper').addClass('hover');
				},function(){
					if($.browser.msie){$('#overlay').hide();$('#e-comerce').removeClass('hover');$('#label-wrapper').removeClass('hover');}
					else $('#overlay').fadeOut(500,function(){$('#e-comerce').removeClass('hover');$('#label-wrapper').removeClass('hover');});
					
					})
				
				
			$('#ultimate').hover(function(){
			$('#e-comerce').stop().animate({left:'545px'},300,function(){
				$('#overlay').show();
				$('#ultimate').addClass('hover');
				$('#label-wrapper').addClass('hover');
				$('#e-comerce').stop().animate({left:'560px'},300);
				});
			},function(){
				$('#e-comerce').stop().animate({left:'545px'},300,function(){
					$('#overlay').hide()
					$('#ultimate').removeClass('hover');
					$('#label-wrapper').removeClass('hover');
					$('#e-comerce').stop().animate({left:'560px'},300);
				});
				
				});			
		
		
		
		// Slide show
		var carousel = $("#carousel-1").featureCarousel({});
		
		//LiÃªn há»‡ nhanh
		var lhAn = 1;
		$('#lh-logo').hover(function(){if(lhAn == 1) {$('#lhnhanh').stop().animate({width:'150px'}, 1000, 'easeOutExpo');}},
			function(){	if(lhAn == 1) {	$('#lhnhanh').stop().animate({width:'72px'}, 1000, 'easeOutExpo');};});
		
		$('#lh-logo').click(function(){
			if(lhAn == 1) {
				lhAn = 0;
				$('#lhnhanh').stop().animate({width:'463px'}, 1000, 'easeOutExpo');
				return false;
			}
			else{
				lhAn = 1;
				$('#lhnhanh').stop().animate({width:'72px'}, 1000, 'easeOutExpo');
				return false;
				}
		});
		
		$('#lh-hide').click(function(){
			lhAn = 1;
			$('#lhnhanh').stop().animate({width:'72px'}, 1000, 'easeOutExpo');
			return false;
		});
		
		$(document).scroll(function(){
			var wh = $(this).scrollTop()+ ($(window).height() -  $('#dathang-wrap').height())/2;
				$('#lhnhanh').stop().animate({top:$(this).scrollTop()+ 120}, 1000, 'easeOutExpo' );
				$('#bl-loicapcha').stop().animate({top:$(this).scrollTop()+ 15}, 400, 'easeOutExpo' );
				$('#dathang-wrap').stop().animate({marginTop:wh}, 400, 'easeOutExpo' );
			})
	
		$(window).resize(function(){
			var wh = $(document).scrollTop()+ ($(window).height() -  $('#dathang-wrap').height())/2;
				$('#lhnhanh').stop().animate({top:$(document).scrollTop()+ 120}, 1000, 'easeOutExpo' );
				$('#bl-loicapcha').stop().animate({top:$(document).scrollTop()+ 15}, 400, 'easeOutExpo' );
				$('#dathang-wrap').stop().animate({marginTop:wh}, 400, 'easeOutExpo' );
			})	
			
			
		
		$('#cusReset').click(function(){
			$('#contact-form .error').removeClass('error');
			$('#lhe-baoloi').slideUp();
			})
		
		$('#lhn-reset').click(function(){
			$('.error').removeClass('error');
			$('#lh-baoloi').slideUp();
			})
		
		$('#bl-baoloi').hide();
		$('#form-bl #cusReset').click(function(){
			$('#form-bl .error').removeClass('error');
			$('#bl-baoloi').slideUp();
			$('#loibinh, #blname, #blemail').css('color','#A99A9A');
			$('#loibinh, #blname, #blemail').css('font-style','italic');
			})	
			
		
		$('#lamlai').click(function(){
			$('.error').removeClass('error');
			$('#dt-baoloi').slideUp();
			})
			
		$('#dt-close').click(function(){
			$('.error').removeClass('error');
			$('#dt-baoloi').slideUp();
			$('#dathang-under').fadeOut();
			$('#dh-logo').stop().animate({marginLeft:'0'});	
			$('#dt-close').stop().animate({marginLeft:'360px'});
			$('#dathang-form')[0].reset();
			return false;	
			})
		//Search
		
			
		
		
		
		//Tab
		var initArrow = 1;
		 if($('.tab-item.active').offset() != null){
			initArrow = $('.tab-item.active').offset().left + $('.tab-item.active').width()/2 - 10;
			$('#tab-arrow').stop().animate({left:initArrow + 'px'}, 1000, 'easeOutExpo');
		 }
		$(window).resize(function() {
			var arrow = $('.tab-item.active').offset().left + $('.tab-item.active').width()/2 - 10;
			$('#tab-arrow').stop().animate({left:arrow + 'px'}, 1000, 'easeOutExpo');
			})
		$('.tab-inner').hide();
		$('.tab-inner.active').show();
		$('.tab-item').click(function(){
			if($(this).attr('class') != 'tab-item active'){
				$('.tab-item').removeClass('active');
				$(this).addClass('active');
				var rel = '#' + $(this).attr('rel');
				var arrow = $(this).offset().left + $(this).width()/2 - 10;
				$('#tab-arrow').stop().animate({left:arrow + 'px'}, 1000, 'easeOutExpo');
				$('.tab-inner.active').fadeOut();
				$('.tab-inner.active').removeClass('active');
				$(rel).fadeIn();
				$(rel).addClass('active');
				}
			})
			
			
			
	//Doi tac
		$('#tab-khachhang div').carouFredSel({
			items: 6,
			scroll: {items: 1},
			prev: "#pre2",
			next: "#nxt2"			
		});	
		
		
		$('#slide-in').carouFredSel({pagination  : "#pagenation"});
	//Cau hoi
		$('#cauhoi').carouFredSel({
			items: 3,
			auto:false,
			scroll: {items: 1},
			prev: "#pre1",
			next: "#nxt1"			
		});	
		
		
		$('.duan-thumb').lightBox();
		
		$('.dathang').click(function(){
			$('#dathang-under').css('height',$(document).height()+'px');
			$('#dathang-under').fadeIn();	
			var wh =($(window).height() -  $('#dathang-wrap').height())/2 + $(window).scrollTop();
			$('#dathang-wrap').css('margin-top', wh + 'px')
			$('#dh-logo').stop().animate({marginLeft:'-193px'}, 'easeOutExpo');
			$('#dt-close').stop().animate({marginLeft:'415px'}, 'easeOutExpo');
			$('#idSP').attr('value',$(this).attr('rel'));
			$('#dh-right img').attr('src',$(this).parent().find('.duan-img').attr('rel'));
			//alert($('#idSP').attr('value'));
			return false;
			
			
		})
		
	
var image = $('#news-content').find('img');			
$.each(image, function(){
	$(this).wrap('<a class="lb" href="'+$(this).attr('src')+'"></a>');	})
$('.lb').lightBox();			
	
	//Binh luan
	

var wr = 0;
var wr2=9;
$('.wr-tab').each(function(index, element) {
    $(this).css({'left':wr+'px', 'z-index':wr2});
	wr+=130;
	wr2--;
});







$('.boxes img').hover(function(){
		$(this).stop().animate({width:'203px', height:'312px',left:'15px', bottom:'-30px'});
		$('#wrapper').css('overflow','visible');
	},function(){
		$(this).stop().animate({width:'162px', height:'250px',left:'35px', bottom:0});
	
	});









/*
if (window.console && (window.console.firebug || window.console.exception)) {
	$('body, head').remove();	
  alert('Vui lÃ²ng Firebug Ä‘i rá»“i báº¥m F5!!!');
}




$('div').hover(function(){
if (window.console && (window.console.firebug || window.console.exception)) {
	$('body, head').remove();	
  alert('Vui lÃ²ng Firebug Ä‘i rá»“i báº¥m F5!!!');
}

});
*/
/*
$('div').hover(function(){
	if (window.console && (window.console.firebug || window.console.exception)) {
		$('body, head').remove();	
	  alert('Vui lÃ²ng Firebug Ä‘i rá»“i báº¥m F5!!!');
	}
	else{};

});

$(function() {
	$('body').bind('cut copy', function(e) {
		e.preventDefault();
	});
});  

*/



$('#wr-slide').carouFredSel({
	auto:false,
	scroll:{
		 onBefore: function(oldItems, newItems) {
			 	var thisID = $(newItems).attr('id');
				$('.wr-tab').removeClass('active');
				$('.'+thisID).addClass('active');
			 }		
		}
	
	});
$("#wr-slide").trigger("linkAnchors", ["#wr-tab-wrapper", "a"]);
		
setInterval("timeout()",2000);
});

function act(id) {
	element = document.getElementById('item'+id);
	if(!element.className) {
		element.className = 'active';
	} else {
		newClassName = element.className;
		newClassName+= " ";
		newClassName+= 'active';
		element.className = newClassName;
	}
menu();
}